import { _mallStore } from "@/store/config";
import { TypeFilters } from "@/interface/filters";
import { isWanLingHuiCustom } from "@/utils/customMall";

// 性别
export const GenderFilters = (): TypeFilters.filter[] => {
    return [
        { value: 0, label: '保密' },
        { value: 1, label: '男' },
        { value: 2, label: '女' },
    ];
}

// 付费会员状态
export const PremiumStatus = (): TypeFilters.filter[] => {
    return [
        { value: 1, label: '生效中' },
        { value: 2, label: '未开通' },
        { value: 3, label: '已过期' },
    ]
}

// 会员列表状态
export const MemberStatus = (): TypeFilters.filter[] => {
    return [
        { label: '正常', value: 1, color: '#7ED321' },
        { label: '已注销', value: 2, color: '#FF6969' },
        { label: '禁用', value: 3, color: '#FF6969' },
    ]
}

// 优惠券 券用途
const isPurpose1: TypeFilters.filter = { value: 1, paraphrase: 'youHuiQuanJia', label: '优惠券架' };
const isPurpose2: TypeFilters.filter = { value: 2, paraphrase: 'huHongYouXi', label: '互动游戏奖池' };
const isPurpose5: TypeFilters.filter = { value: 5, paraphrase: 'dingXiangFaQuan', label: '定向发券' };
const isPurpose7: TypeFilters.filter = { value: 7, paraphrase: 'saoMaFaQuan', label: '扫码发券' };
const isPurpose9: TypeFilters.filter = { value: 9, paraphrase: 'youJiaQuanBao', label: '有价券包' };
const isPurpose17: TypeFilters.filter = { value: 17, paraphrase: 'youJiaFenLeiQuanBao', label: '有价分类券包' };
const isPurpose13: TypeFilters.filter = { value: 13, paraphrase: 'wenJuanDiaoCha', label: '问卷调查' };

export const CouponPurpose = () => {
    if (_mallStore.isUniqueMemberMall) {
        // 统一会员集团商场管理页
        return [
            isPurpose1,
            isPurpose2,
            isPurpose5,
            isPurpose7,
            isPurpose9,
            isPurpose17,
            isPurpose13,
            { value: 14, paraphrase: 'fuFeiHuiYuan', label: '付费会员礼' },
        ]
    } else {
        // 非统一会员商场管理页 或 统一会员集团页
        return [
            isPurpose1,
            isPurpose2,
            { value: 3, paraphrase: 'zhuCeSongHaoLi', label: '注册送好礼' },
            { value: 4, paraphrase: 'huiYuanDengJiLi', label: '会员等级礼' },
            isPurpose5,
            { value: 6, paraphrase: 'qianDaoJiangLi', label: '签到奖励' },
            isPurpose7,
            { value: 8, paraphrase: 'wanShanXinXiLi', label: '完善信息礼' },
            isPurpose9,
            isPurpose17,
            isPurpose13,
        ]
    }
}

// 发放平台
export const SendPlatform = () => {
    return [
        { value: 3, label: '闪购' },
        { value: 4, label: '汇纳' },
        { value: 1, label: '闪购+汇纳' }
    ]
}

// 优惠券 状态
export const CouponStatus = (): TypeFilters.filter[] => {
    return [
        { value: '', label: '全部' },
        { value: 2, paraphrase: 'weiKaiShi', label: '未开始', color: '#ff9019' },
        { value: 8, paraphrase: 'yuReZhong', label: '预热中', color: '#F57383' },
        { value: 1, paraphrase: 'faFangZhong', label: '发放中', color: '#7ED321' },
        { value: 0, paraphrase: 'daiShenHe', label: '待审核', color: '#F57383' },
        { value: 4, paraphrase: 'xiaJiaZhong', label: '下架中', color: '#AAB2C5' },
        { value: 5, paraphrase: 'faFangJieShu', label: '发放结束', color: '#AAB2C5' },
    ];
}

// 优惠券 券用途 扫码发券 二级选项
export const CouponScanCodeSubTypes = () => {
    return [
        { value: 2, paraphrase: 'zhuSaoJiaBeiSao', label: '用户端主扫+被扫' },
        { value: 3, paraphrase: 'jinBeiSao', label: '仅用户端被扫' },
    ]
}

// 优惠券 定价方式
export const CouponPriceType = () => {
    return [
        { value: 1, label: '现金' },
        { value: 2, label: '现金+积分' },
    ]
}

// 优惠券 适用范围
export const CouponChannel = () => {
    return [
        { value: 1, paraphrase: 'xianXia', label: '线下券', text: '线下使用' },
        { value: 2, paraphrase: 'xianShang', label: '线上券', text: '线上使用' },
        { value: 3, paraphrase: 'xianShangXianXia', label: '线上线下通用券', text: '线上线下使用' },
    ]
}

// 优惠券 券类型
export const CouponTypes = () => {
    return [
        { value: 1, paraphrase: 'manJian', label: '满减券' },
        { value: 4, paraphrase: 'xianJin', label: '现金券' },
        { value: 2, paraphrase: 'zheKou', label: '折扣券' },
        { value: 3, paraphrase: 'liPin', label: '礼品券' },
        { value: 5, paraphrase: 'diYong', label: '抵用券' },
        { value: 7, paraphrase: 'shiChang', label: '时长券' },
    ]
}

// 是否 限领/限购
export const ReceiveRules = (text: string = '领') => {
    const rules = [
        { value: 1, label: '永久限' },
        { value: 2, label: '每日限' },
        { value: 3, label: '每周限' },
        { value: 4, label: '每月限' },
        { value: 5, label: '每季度限' },
        { value: 6, label: '每年限' },
    ]
    for (let row of rules) {
        row.label += text;
    }
    return rules;
}


// 支付方式
// 显示交易号
export const ShowPaidSourceValue = ['支付宝', '微信', '云闪付'];
export const getPayWayFilters = () => {
    const _filters: string[] = [...ShowPaidSourceValue, '现金', '银行卡', '线上支付', '其他'];
    const _value = [];
    for (let val of _filters) {
        _value.push({ value: val, label: val })
    }
    return _value;
}

// 支付方式
export const getShowPaidSource = () => {
    return ['支付宝', '微信', '云闪付'];
}
export const PayWayFilters = () => {
    const filters = [...getShowPaidSource(), '现金', '银行卡', '线上支付', '其他'];
    const _value = [];
    for (let val of filters) {
        _value.push({ value: val, label: val })
    }
    return _value;
}

// 消费记录来源
export const PayOriginFilters = () => {
    const filters = ['小票上传', '服务台记录', '拼团', '闪购', '停车缴费', '小程序收银', '云闪付', '银联POS'];
    if (isWanLingHuiCustom()) {
        filters.push('第三方同步');
    } else {
        filters.push('crm同步');
    }
    if (_mallStore.isPaidMember) {
        filters.push('购买付费会员');
    }
    const _value: TypeFilters.filter[] = [];
    for (let val of filters) {
        _value.push({ value: val, label: val });
    }
    if (!(_mallStore.isUniqueMember && _mallStore.isGroupManagementPage)) {
        _value.push({ value: 9, label: '无感积分' });
    }
    return _value;
}
